<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $this->title;?></title>
<link rel="stylesheet" href="<?php echo $this->baseUrl;?>/files/admin/css/main.css" />
<link rel="stylesheet" href="bi.css" />
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/jquery.js"></script>
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/load.js"></script>
<!--时间选择器-->
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/date/calendar.js"></script>
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/date/lang/cn_utf8.js"></script>
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/date/calendar-setup.js"></script>
<link rel="stylesheet" href="<?php echo $this->baseUrl;?>/files/admin/js/date/calendar-blue.css" />
<!--colorbox-->
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/colorbox.jquery/jquery.colorbox.js"></script>
<link href="<?php echo $this->baseUrl;?>/files/admin/js/colorbox.jquery/colorbox2.css" rel="stylesheet" type="text/css"/>

<!--bi-->
<link rel="stylesheet" href="<?php echo $this->baseUrl;?>/files/admin/css/bi.css" />
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/bi.js"></script>


</head>
<body style="overflow:auto;">
<div id="main" style="clear:both;">
		<div class="bi-body">
			<form id="searchForm" name="searchForm" method="post" action="<?php echo $this->projectUrl(array('action'=>'index'));?>">
			<div class="bi-search">
				<div class="bi-s-top"></div>
				<div class="bi-s-center">
					<div class="bi-s-c-con">
						<div class="bi-s-c-date">
							<table width="100%" border="0" cellspacing="0" cellpadding="0">
							  <tr>
								<td><a onclick="setSelDate(1);">昨天</a> <a onclick="setSelDate(2);">最近7天</a> <a onclick="setSelDate(3);">最近30天</a> <a onclick="setSelDate(4);">最近三个月</a> <a onclick="setSelDate(0);">全部</a></td>
								<td width="50">日期从 </td>
								<td width="90">
								<span class="NFTextLeft"></span>
								<div class="NFTextCenter">
									<input name="startTime" type="text" id="startTime" size="9" value="<?php echo isset($this->vars['dateType']) ? $this->vars['startTime'] : date('Y-m-d',strtotime("-1 day")) ;?>" />
								</div>
								<span class="NFTextRight"></span>
								<script type="text/javascript">Calendar.setup({"ifFormat":"%Y-%m-%d","firstDay":0,"showsTime":false,"showOthers":false,"timeFormat":24,"inputField":"startTime","button":"startTime"});</script></td>
								<td width="20"> 至 </td>
								<td width="90">
								<span class="NFTextLeft"></span>
								<div class="NFTextCenter">
									<input name="endTime" type="text"  id="endTime" size="9" value="<?php echo isset($this->vars['dateType']) ? $this->vars['endTime'] : date('Y-m-d',strtotime("-1 day")) ;?>" />
								</div>
								<span class="NFTextRight"></span>
									<script type="text/javascript">Calendar.setup({"ifFormat":"%Y-%m-%d","firstDay":0,"showsTime":false,"showOthers":false,"timeFormat":24,"inputField":"endTime","button":"endTime"});</script></td>
								<td width="110"></td>
							  </tr>
							</table>

						</div>
						
						<div class="bi-s-c-sel">
								<table width="100%" border="0" cellspacing="0" cellpadding="0">
								  <tr>
									<td>地区选择：
										<select name="areas" id="areas" >
										  <option value="">全国</option>
										</select></td>
									</tr>
								</table>
						</div>		
						<div class="bi-s-c-sel">	
							<table width="100%" border="0" cellspacing="0" cellpadding="0">
							  <tr>
								  <td>操作系统：
										<select name="osName" id="osName" size="1">
											<option value="">全部</option>
											<option value="iphone" <?php if($this->vars['osName']=='iphone'){?>selected="selected"<?php }?>>iPhone</option>
											<option value="android" <?php if($this->vars['osName']=='android'){?>selected="selected"<?php }?>>Android</option>
											<option value="symbian" <?php if($this->vars['osName']=='symbian'){?>selected="selected"<?php }?>>Symbian</option>
											<option value="windowphone" <?php if($this->vars['osName']=='windowphone'){?>selected="selected"<?php }?>>Windows Phone 7</option>
											<option value="wap" <?php if($this->vars['osName']=='wap'){?>selected="selected"<?php }?>>Wap</option>
										</select></td>		
									<td width="40">渠道：</td>
									<td><span class="NFTextLeft"></span>
										<div class="NFTextCenter">
											<input name="source" type="text" id="source" size="16" value="<?php echo $this->vars['source'];?>" />
										</div>
										<span class="NFTextRight"></span>
									</td>
									<td width="80">SourceId ：</td>
									<td><span class="NFTextLeft"></span>
										<div class="NFTextCenter">
											<input name="sourceId" type="text" id="sourceId" size="16" value="<?php echo $this->vars['sourceId'];?>" />
										</div>
										<span class="NFTextRight"></span>
									</td>
									<td width="120"></td>
								  </tr>
								</table>
						</div>
						
						<div class="bi-s-c-path">
							<div class="c-left">
							   <span>路径选择：
										<select name="level01" id="level01">
											<?php 
												foreach($this->pageRows1 as $key=>$row) {
											?>
											<option value="<?php echo $row['pageId'];?>" <?php if($this->vars['level01']==$row['pageId']){?>selected="selected" <?php } ?>><?php echo $row['pageName']; ?></option>
											<?php
												}
											?>
										</select>
										</span>
										<span>二级目录：
										<select name="level02" id="level02" >
										  <?php 
												foreach($this->pageRows2 as $key=>$row) {
											?>
											<option value="<?php echo $row['pageId']; ?>" <?php if($this->vars['level02']==$row['pageId']){?>selected="selected" <?php } ?>><?php echo $row['pageName']; ?></option>
											<?php
												}
											?>
										</select></span>
										<span>三级目录：
										<select name="level03" id="level03">
										  <?php 
												foreach($this->pageRows3 as $key=>$row) {
													if($row['pageId']!='1007'){
											?>
											<option value="<?php echo $row['pageId']; ?>" <?php if($this->vars['level03']==$row['pageId']){?>selected="selected" <?php } ?>><?php echo $row['pageName']; ?></option>
											<?php
													}
												}
											?>
										</select></span>
										<span>四级目录：
										<select name="level04" id="level04" >
										  <?php 
												foreach($this->pageRows4 as $key=>$row) {
											?>
											<option value="<?php echo $row['pageId']; ?>" <?php if($this->vars['level04']==$row['pageId']){?>selected="selected" <?php } ?>><?php echo $row['pageName']; ?></option>
											<?php
												}
											?>
										</select></span>
										<span>五级目录：
										<select name="level05" id="level05" >
										  <?php 
												foreach($this->pageRows5 as $key=>$row) {
											?>
											<option value="<?php echo $row['pageId']; ?>" <?php if($this->vars['level05']==$row['pageId']){?>selected="selected" <?php } ?>><?php echo $row['pageName']; ?></option>
											<?php
												}
											?>
										</select></span>
										<span>六级目录：
										<select name="level06" id="level06" >
										  <?php 
												foreach($this->pageRows6 as $key=>$row) {
											?>
											<option value="<?php echo $row['pageId']; ?>" <?php if($this->vars['level06']==$row['pageId']){?>selected="selected" <?php } ?>><?php echo $row['pageName']; ?></option>
											<?php
												}
											?>
										</select></span>
										<span>七级目录：
										<select name="level07" id="level07" >
										  <?php 
												foreach($this->pageRows7 as $key=>$row) {
											?>
											<option value="<?php echo $row['pageId']; ?>" <?php if($this->vars['level07']==$row['pageId']){?>selected="selected" <?php } ?>><?php echo $row['pageName']; ?></option>
											<?php
												}
											?>
										</select></span>
								<div class="clear"></div>
							</div>
							<div class="c-right">
								<input name="dateType" type="hidden" id="dateType" value="all" />
								<input name="search" type="submit" id="search" value="" class="s-button"/>
							</div>
						</div>
						
					</div>	
				</div>
				<div class="bi-s-bottom"></div>			
			</div>
			</form>
			
			
			<div class="clear" style="height:20px;"></div>
			<div class="bi-data">
				<div class="bi-d-top">
					<div class="d-t-left">漏斗视图</div>
					<div class="d-t-right"><span <?php if(count($this->rows)>0){?>class="show"<?php } else {?>class="hide"<?php }?> id="data_02" onclick="showData('02')" style="cursor:pointer;"></span></div>
				</div>
				<div class="bi-d-center  clear" id="data02" style="">
					<div class="bi-d-center-bg">
					<!--content start-->
					<?php if(count($this->rows)>0){?>
					<div class="funnelView">
						<table border="0" cellpadding="0" cellspacing="0" class="viewTable">
						  <tr class="view-title">
								<td colspan="3" align="center">访客</td>
								<td><div class="">路径</div></td>
						  </tr>
						<?php 
						foreach($this->rows as $key=>$row) {
							$showInfo = '';
							if($key-1<0){
								if($this->rows[0]['uv']>0){
									$showInfo = "100%";
								} else {
									$showInfo = "0%";
								}
							}else{
								$process = $this->rows[0]['uv']>0 ? number_format($row['uv']/$this->rows[0]['uv'],4)*100 : 0 ;
								$showInfo =  $process."%";
							}
							$continued = '';
							$lost = '';
							if($key-1<0){
								if($this->rows[0]['uv']>0){
									$continued = "100%";
									$lost = "0%";	
								} else {
									$continued = "0%";
									$lost = "100%";
								}
							}else{
								$process = $this->rows[$key-1]['uv']>0 ? number_format($row['uv']/$this->rows[$key-1]['uv'],4)*100 : 0;
								$process = $process<=100 ? $process : 100; 
								$continued = $process."%";
								$process2 = 100-$process;
								if($process2<0){
									$process2 = 0;
								}
								$lost = $process2."%";								
							}
							
						?> 
						  <tr class="line1">
								<td><div class=""><?php echo $row['uv'];?></div></td>
								<td><?php echo $showInfo;?></td>
								<td></td>
								<td align="left">
									<div class="v-team">
										<table width="<?php echo $showInfo;?>" border="0" cellpadding="0" cellspacing="0"><tr><td title="<?php echo $showInfo;?>"></td></tr></table>
										<div class="v-title"><?php echo $row['pageName'];?></div>
									</div>
								</td>
						  </tr>
						  	<?php if($row['pageId']!=1013){?>
							<tr class="line2">
								<td colspan="2"></td>
							  <td valign="top" align="center"><div class="v-arrow"><span></span></div></td>
								<td width="400" align="left" valign="top">
									<div class="v-bi">
										<table width="<?php echo 400*(number_format($row['uv']/$this->rows[0]['uv'],4));?>" border="0" cellpadding="0" cellspacing="0"><tr><td width="<?php echo $continued;?>" class="continued"></td><td width="<?php echo $lost;?>" class="lost"></td></tr></table>
									</div>
								  <div class="v-info">
										<table border="0" cellpadding="0" cellspacing="0"><tr><td align="left"><?php echo $continued;?> 转化,<?php echo $lost;?> 流失</td></tr></table>
									</div>
							  </td>
							</tr>
							<?php }?>
						<?php }?>
					  </table>
					</div>
					
					
					
								
						<table class="table" style=" display:none;">
							<tr class="subject">
								<td>来源</td>
								<td>目标</td>
								<td>目标页名</td>
								<td>浏览次数</td>
								<td>Visit(%)</td>
								<td>Process(%)</td>
							</tr>
							<?php 
							foreach($this->rows as $key=>$row) {
							?>
							<tr class="dataLine">
								<td><?php echo $row['eventPageId'];?></td>
								<td><?php echo $row['pageId'];?></td>
								<td><?php echo $row['pageName'];?></td>
								<td><?php echo $row['uv'];?></td>
								<td><?php 
								if($key-1<0){
									echo "100%";
								}else{
									$process = $this->rows[0]['uv']>0 ? number_format($row['uv']/$this->rows[0]['uv'],3)*100 : 0;
									echo $process."%";
								}
								
								?></td>
								<td><?php 
								if($key-1<0){
									echo "100% Continued";
								}else{
									$process = $this->rows[$key-1]['uv']>0 ? number_format($row['uv']/$this->rows[$key-1]['uv'],3)*100 : 0;
									echo $process."% Continued　";
									$process2 = 100-$process;
									if($process2<0){
										$process2 = 0;
									}
									echo $process2."% Lost";								
								}
								
								?></td>
							</tr>
						<?php }?>
					  </table>
					  <?php }?>
				  	<!--content end-->
				  </div>
				</div>
				<div class="bi-d-bottom"></div>
			</div>
			
			
			
			
			
		</div>
	
</div>
<script language="javascript">
$(function(){
	$("#level02").change(function(){
		//默认移除
		$("#level03 option[value='1021']").remove();
		$("#level03 option[value='1024']").remove();
		
		selValue = $("#level02").val();
		if(selValue==1020||selValue==1022){
			$("#level03").attr('disabled','disabled');
			$("#level03 option:all").remove();			
		} else {
			$("#level03").attr('disabled','');
		}
		if(selValue==1022){
			$("#level05").attr('disabled','disabled');
		} else {
			$("#level05").attr('disabled','');
		}
		
		if(selValue==1005){
			//$("#level03")[0].options[0].selected=true;
			$("#level03 option:all").remove();
			$("<option value='1021'>分类商品列表</option>").appendTo($("#level03"));
		}
		if(selValue==1009){
			//$("#level03")[0].options[1].selected=true;
			$("#level03 option:all").remove();
			$("<option value='1024'>搜索商品列表</option>").appendTo($("#level03"));
		}
		
	})
	
	//默认加载
	$("#level02").change();
	//暂未开放
	//$("#source").attr('disabled','disabled');
	$("#level06").attr('disabled','disabled');
})
</script>
</body>
</html>